package com.ytt.core.service.repository;

import com.ytt.core.service.entity.student.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface StudentRepository extends JpaRepository<Student, Long>, JpaSpecificationExecutor<Student> {
    /**
     * 通过学号查询
     *
     * @param student_id 用户账号
     * @return 用户ID，否则返回null
     */
    @Query("select u.id from Student as u where u.student_id = :student_id")
    Long findByStudent_id(@Param("student_id") String student_id);
}
